<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>数据结构基础小结 | ShuangChenYue</title>
    <meta name="generator" content="VuePress 1.9.10">
    <link rel="icon" href="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg">
    <meta name="description" content="满招损，谦受益">
    <meta name="keywords" content="专注于Cpp语言的旅行者">
    
    <link rel="preload" href="/assets/css/0.styles.952d6952.css" as="style"><link rel="preload" href="/assets/js/app.67adcfd9.js" as="script"><link rel="preload" href="/assets/js/4.9aaa1650.js" as="script"><link rel="preload" href="/assets/js/1.5474518c.js" as="script"><link rel="preload" href="/assets/js/3.593d14fc.js" as="script"><link rel="preload" href="/assets/js/79.3d75e618.js" as="script"><link rel="prefetch" href="/assets/js/10.3242746b.js"><link rel="prefetch" href="/assets/js/100.9224de43.js"><link rel="prefetch" href="/assets/js/101.f0d1b059.js"><link rel="prefetch" href="/assets/js/102.996bfc6d.js"><link rel="prefetch" href="/assets/js/103.9bfdbd6f.js"><link rel="prefetch" href="/assets/js/104.8613f283.js"><link rel="prefetch" href="/assets/js/105.aa6e809e.js"><link rel="prefetch" href="/assets/js/106.90192392.js"><link rel="prefetch" href="/assets/js/107.e82a40b7.js"><link rel="prefetch" href="/assets/js/108.994cd438.js"><link rel="prefetch" href="/assets/js/109.ec15acc2.js"><link rel="prefetch" href="/assets/js/11.c04b41c1.js"><link rel="prefetch" href="/assets/js/110.c32d8576.js"><link rel="prefetch" href="/assets/js/111.453b5d50.js"><link rel="prefetch" href="/assets/js/112.ffbdb3a4.js"><link rel="prefetch" href="/assets/js/113.12b8ad7d.js"><link rel="prefetch" href="/assets/js/114.899d2998.js"><link rel="prefetch" href="/assets/js/115.b7ad9576.js"><link rel="prefetch" href="/assets/js/116.a8394748.js"><link rel="prefetch" href="/assets/js/117.0edfe25b.js"><link rel="prefetch" href="/assets/js/118.9161b1fe.js"><link rel="prefetch" href="/assets/js/119.be59e21b.js"><link rel="prefetch" href="/assets/js/12.41437bf6.js"><link rel="prefetch" href="/assets/js/120.bcf439fb.js"><link rel="prefetch" href="/assets/js/121.c3d251b8.js"><link rel="prefetch" href="/assets/js/122.62b1caba.js"><link rel="prefetch" href="/assets/js/123.787c2ab0.js"><link rel="prefetch" href="/assets/js/124.a880746f.js"><link rel="prefetch" href="/assets/js/125.d8edfe7b.js"><link rel="prefetch" href="/assets/js/126.4ff01546.js"><link rel="prefetch" href="/assets/js/127.9416d1ff.js"><link rel="prefetch" href="/assets/js/128.01a4a7a0.js"><link rel="prefetch" href="/assets/js/129.76876665.js"><link rel="prefetch" href="/assets/js/13.922328e9.js"><link rel="prefetch" href="/assets/js/130.7f631dd9.js"><link rel="prefetch" href="/assets/js/131.c9e0fde9.js"><link rel="prefetch" href="/assets/js/132.1c04cde5.js"><link rel="prefetch" href="/assets/js/133.e8f381cd.js"><link rel="prefetch" href="/assets/js/134.03d19f8b.js"><link rel="prefetch" href="/assets/js/135.44607494.js"><link rel="prefetch" href="/assets/js/136.6a1eb3c9.js"><link rel="prefetch" href="/assets/js/137.27898fd1.js"><link rel="prefetch" href="/assets/js/138.5bc0cf54.js"><link rel="prefetch" href="/assets/js/139.c2d1addc.js"><link rel="prefetch" href="/assets/js/14.e54d7526.js"><link rel="prefetch" href="/assets/js/140.052ec8e4.js"><link rel="prefetch" href="/assets/js/141.131abb5a.js"><link rel="prefetch" href="/assets/js/142.6ba6c07b.js"><link rel="prefetch" href="/assets/js/143.5dd51d22.js"><link rel="prefetch" href="/assets/js/144.b45afca8.js"><link rel="prefetch" href="/assets/js/145.faa9fb04.js"><link rel="prefetch" href="/assets/js/146.b54c024d.js"><link rel="prefetch" href="/assets/js/147.a1223242.js"><link rel="prefetch" href="/assets/js/148.4767bcb2.js"><link rel="prefetch" href="/assets/js/149.b65ab046.js"><link rel="prefetch" href="/assets/js/15.7082a3da.js"><link rel="prefetch" href="/assets/js/150.9bd8c175.js"><link rel="prefetch" href="/assets/js/151.9f830e96.js"><link rel="prefetch" href="/assets/js/152.41cde7f0.js"><link rel="prefetch" href="/assets/js/153.f57d65e0.js"><link rel="prefetch" href="/assets/js/154.5d7c8d51.js"><link rel="prefetch" href="/assets/js/155.0ae99532.js"><link rel="prefetch" href="/assets/js/156.5a54e043.js"><link rel="prefetch" href="/assets/js/157.c25b5d40.js"><link rel="prefetch" href="/assets/js/158.aa025b46.js"><link rel="prefetch" href="/assets/js/159.47939d88.js"><link rel="prefetch" href="/assets/js/16.fc775b7b.js"><link rel="prefetch" href="/assets/js/160.f8624459.js"><link rel="prefetch" href="/assets/js/161.7a075dc2.js"><link rel="prefetch" href="/assets/js/162.1d48f266.js"><link rel="prefetch" href="/assets/js/163.5d68a99f.js"><link rel="prefetch" href="/assets/js/164.1262d0e5.js"><link rel="prefetch" href="/assets/js/165.2ccf0bdd.js"><link rel="prefetch" href="/assets/js/166.21ece4d9.js"><link rel="prefetch" href="/assets/js/167.bf8adb95.js"><link rel="prefetch" href="/assets/js/168.1cb8440d.js"><link rel="prefetch" href="/assets/js/169.1dd1e396.js"><link rel="prefetch" href="/assets/js/17.ecc7be70.js"><link rel="prefetch" href="/assets/js/170.c29ec18f.js"><link rel="prefetch" href="/assets/js/171.38820827.js"><link rel="prefetch" href="/assets/js/172.bbc8ffc6.js"><link rel="prefetch" href="/assets/js/173.470e21e7.js"><link rel="prefetch" href="/assets/js/174.3c2df318.js"><link rel="prefetch" href="/assets/js/175.d2690cdb.js"><link rel="prefetch" href="/assets/js/176.9ca64696.js"><link rel="prefetch" href="/assets/js/177.76f3271d.js"><link rel="prefetch" href="/assets/js/178.d7d9def2.js"><link rel="prefetch" href="/assets/js/179.b5644743.js"><link rel="prefetch" href="/assets/js/18.31fe7ecd.js"><link rel="prefetch" href="/assets/js/180.7592d5ef.js"><link rel="prefetch" href="/assets/js/181.5cb77d35.js"><link rel="prefetch" href="/assets/js/182.6fa5633c.js"><link rel="prefetch" href="/assets/js/183.b3a53d1b.js"><link rel="prefetch" href="/assets/js/184.3815c537.js"><link rel="prefetch" href="/assets/js/185.bcf4ab71.js"><link rel="prefetch" href="/assets/js/186.1cc02f6d.js"><link rel="prefetch" href="/assets/js/187.8b425fb7.js"><link rel="prefetch" href="/assets/js/188.44ccbd02.js"><link rel="prefetch" href="/assets/js/189.353b35e3.js"><link rel="prefetch" href="/assets/js/19.520992d5.js"><link rel="prefetch" href="/assets/js/190.c284595f.js"><link rel="prefetch" href="/assets/js/191.788ecc2d.js"><link rel="prefetch" href="/assets/js/192.712a164e.js"><link rel="prefetch" href="/assets/js/193.da58aba3.js"><link rel="prefetch" href="/assets/js/194.6b1b1f4d.js"><link rel="prefetch" href="/assets/js/195.c31d5c39.js"><link rel="prefetch" href="/assets/js/196.f6670c4d.js"><link rel="prefetch" href="/assets/js/197.5a1f50ab.js"><link rel="prefetch" href="/assets/js/2.ab565158.js"><link rel="prefetch" href="/assets/js/20.69e29cdc.js"><link rel="prefetch" href="/assets/js/21.2fd424ad.js"><link rel="prefetch" href="/assets/js/22.d4c0be54.js"><link rel="prefetch" href="/assets/js/23.4bb90ecc.js"><link rel="prefetch" href="/assets/js/24.c01be6b2.js"><link rel="prefetch" href="/assets/js/25.c8833687.js"><link rel="prefetch" href="/assets/js/26.8042b555.js"><link rel="prefetch" href="/assets/js/27.0d5fa4c0.js"><link rel="prefetch" href="/assets/js/28.f9735b8b.js"><link rel="prefetch" href="/assets/js/29.3af53626.js"><link rel="prefetch" href="/assets/js/30.5f1b56d1.js"><link rel="prefetch" href="/assets/js/31.544b2649.js"><link rel="prefetch" href="/assets/js/32.aa321988.js"><link rel="prefetch" href="/assets/js/33.6aba2c86.js"><link rel="prefetch" href="/assets/js/34.e1bbff24.js"><link rel="prefetch" href="/assets/js/35.233f76e0.js"><link rel="prefetch" href="/assets/js/36.cb773972.js"><link rel="prefetch" href="/assets/js/37.393d9c59.js"><link rel="prefetch" href="/assets/js/38.e2d530c5.js"><link rel="prefetch" href="/assets/js/39.acaf1cc0.js"><link rel="prefetch" href="/assets/js/40.358f731e.js"><link rel="prefetch" href="/assets/js/41.ded24b7e.js"><link rel="prefetch" href="/assets/js/42.b9f683c3.js"><link rel="prefetch" href="/assets/js/43.c8fb3e66.js"><link rel="prefetch" href="/assets/js/44.633142da.js"><link rel="prefetch" href="/assets/js/45.6095e772.js"><link rel="prefetch" href="/assets/js/46.421d8c7a.js"><link rel="prefetch" href="/assets/js/47.da50fe47.js"><link rel="prefetch" href="/assets/js/48.15ff5726.js"><link rel="prefetch" href="/assets/js/49.b662e624.js"><link rel="prefetch" href="/assets/js/5.c1b8a209.js"><link rel="prefetch" href="/assets/js/50.a8bc75df.js"><link rel="prefetch" href="/assets/js/51.51e36ae7.js"><link rel="prefetch" href="/assets/js/52.54cc6e51.js"><link rel="prefetch" href="/assets/js/53.4173561d.js"><link rel="prefetch" href="/assets/js/54.7cab8416.js"><link rel="prefetch" href="/assets/js/55.3d7317d3.js"><link rel="prefetch" href="/assets/js/56.3c22255b.js"><link rel="prefetch" href="/assets/js/57.18e46e30.js"><link rel="prefetch" href="/assets/js/58.aad57f31.js"><link rel="prefetch" href="/assets/js/59.7897f6a7.js"><link rel="prefetch" href="/assets/js/6.3131f88a.js"><link rel="prefetch" href="/assets/js/60.5cd0051a.js"><link rel="prefetch" href="/assets/js/61.d9606403.js"><link rel="prefetch" href="/assets/js/62.aede9df0.js"><link rel="prefetch" href="/assets/js/63.2c30e554.js"><link rel="prefetch" href="/assets/js/64.18228ab7.js"><link rel="prefetch" href="/assets/js/65.27cb3fba.js"><link rel="prefetch" href="/assets/js/66.2fa6c2dc.js"><link rel="prefetch" href="/assets/js/67.d274a8df.js"><link rel="prefetch" href="/assets/js/68.3069cfcf.js"><link rel="prefetch" href="/assets/js/69.4c28600f.js"><link rel="prefetch" href="/assets/js/7.89e6165d.js"><link rel="prefetch" href="/assets/js/70.4175440c.js"><link rel="prefetch" href="/assets/js/71.2ee6b435.js"><link rel="prefetch" href="/assets/js/72.c75e3bb8.js"><link rel="prefetch" href="/assets/js/73.6f8b8211.js"><link rel="prefetch" href="/assets/js/74.6c7720cf.js"><link rel="prefetch" href="/assets/js/75.cccfb229.js"><link rel="prefetch" href="/assets/js/76.f022e5da.js"><link rel="prefetch" href="/assets/js/77.dab46206.js"><link rel="prefetch" href="/assets/js/78.ca574b2a.js"><link rel="prefetch" href="/assets/js/80.091749b1.js"><link rel="prefetch" href="/assets/js/81.14db0e21.js"><link rel="prefetch" href="/assets/js/82.8a2b1809.js"><link rel="prefetch" href="/assets/js/83.84a4b599.js"><link rel="prefetch" href="/assets/js/84.11d7c222.js"><link rel="prefetch" href="/assets/js/85.273d4388.js"><link rel="prefetch" href="/assets/js/86.fb40e20c.js"><link rel="prefetch" href="/assets/js/87.3316639e.js"><link rel="prefetch" href="/assets/js/88.dfc52200.js"><link rel="prefetch" href="/assets/js/89.8d615f6e.js"><link rel="prefetch" href="/assets/js/90.1d9f08bb.js"><link rel="prefetch" href="/assets/js/91.566813e7.js"><link rel="prefetch" href="/assets/js/92.d13c6f41.js"><link rel="prefetch" href="/assets/js/93.845c42a0.js"><link rel="prefetch" href="/assets/js/94.20a37b77.js"><link rel="prefetch" href="/assets/js/95.1a498005.js"><link rel="prefetch" href="/assets/js/96.39fa7f4b.js"><link rel="prefetch" href="/assets/js/97.50f7170e.js"><link rel="prefetch" href="/assets/js/98.dd2e15d6.js"><link rel="prefetch" href="/assets/js/99.ef7ea06a.js"><link rel="prefetch" href="/assets/js/vendors~docsearch.ae6b1de9.js">
    <link rel="stylesheet" href="/assets/css/0.styles.952d6952.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg" alt="ShuangChenYue" class="logo"> <span class="site-name can-hide">ShuangChenYue</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" aria-current="page" class="nav-link router-link-exact-active router-link-active">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="嵌入式软件开发" class="dropdown-title"><!----> <span class="title" style="display:;">嵌入式软件开发</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d142c2/" class="nav-link">电子嵌入式通信协议</a></li><li class="dropdown-item"><!----> <a href="/pages/4c6bf3/" class="nav-link">深入浅出SSD</a></li><li class="dropdown-item"><!----> <a href="/pages/d3f36a/" class="nav-link">文件系统</a></li><li class="dropdown-item"><!----> <a href="/pages/e0cca7/" class="nav-link">汇编语言</a></li><li class="dropdown-item"><!----> <a href="/pages/fab2d7/" class="nav-link">STM32</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/db6fb8/" class="nav-link">Git备忘清单</a></li><li class="dropdown-item"><!----> <a href="/pages/e1081f/" class="nav-link">Git 创建删除远程分支</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/1ab9a6/" class="nav-link">Shell 脚本学习笔记</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/907786/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/a2d21e/" class="nav-link">kylinV10-SP1 安装 QT</a></li><li class="dropdown-item"><!----> <a href="/pages/b561cf/" class="nav-link">高并发内存池</a></li><li class="dropdown-item"><!----> <a href="/pages/6ab6d1/" class="nav-link">USBGUARD 项目编译环境配置</a></li><li class="dropdown-item"><!----> <a href="/pages/883f02/" class="nav-link">Power_Destory 项目</a></li><li class="dropdown-item"><!----> <a href="/pages/479472/" class="nav-link">U 盘清除工具编译教程</a></li><li class="dropdown-item"><!----> <a href="/pages/9c4241/" class="nav-link">个人博客代码推送教程</a></li><li class="dropdown-item"><!----> <a href="/pages/3ad765/" class="nav-link">SVN Trunk Branches的Merge操作</a></li><li class="dropdown-item"><!----> <a href="/pages/0c0ca8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="MFC" class="dropdown-title"><!----> <span class="title" style="display:;">MFC</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/a4b108/" class="nav-link">MFC编程随记</a></li><li class="dropdown-item"><!----> <a href="/pages/41acbd/" class="nav-link">MFC实现ini配置文件的读取</a></li><li class="dropdown-item"><!----> <a href="/pages/951a7a/" class="nav-link">MFC实现点击列表头排序</a></li><li class="dropdown-item"><!----> <a href="/pages/a8598f/" class="nav-link">贴图法美化Button按钮</a></li><li class="dropdown-item"><!----> <a href="/pages/054516/" class="nav-link">MFC使用细节</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="闪存" class="dropdown-title"><!----> <span class="title" style="display:;">闪存</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/b925b8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li><li class="dropdown-item"><!----> <a href="/pages/28ec23/" class="nav-link">NAND Flash</a></li><li class="dropdown-item"><!----> <a href="/pages/62bf40/" class="nav-link">ARM 处理器</a></li><li class="dropdown-item"><!----> <a href="/pages/1a9374/" class="nav-link">嵌入式基础知识-存储器</a></li><li class="dropdown-item"><!----> <a href="/pages/aac5e3/" class="nav-link">闪存存储和制造技术概述</a></li><li class="dropdown-item"><!----> <a href="/pages/8f6056/" class="nav-link">芯片IO驱动力</a></li><li class="dropdown-item"><!----> <a href="/pages/d146b8/" class="nav-link">主流先进封装技术介绍</a></li><li class="dropdown-item"><!----> <a href="/pages/16f0ba/" class="nav-link">NAND Flash基础</a></li><li class="dropdown-item"><!----> <a href="/pages/90d8d0/" class="nav-link">基于PA算法的FTL引导</a></li><li class="dropdown-item"><!----> <a href="/pages/eb672b/" class="nav-link">SD逻辑擦除和物理擦除</a></li><li class="dropdown-item"><!----> <a href="/pages/747121/" class="nav-link">NAND Flash的SDR、ONFI、DDR接口</a></li><li class="dropdown-item"><!----> <a href="/pages/1eb351/" class="nav-link">【详解】Nand Flash必看知识</a></li><li class="dropdown-item"><!----> <a href="/pages/d2512a/" class="nav-link">【两万字详解】Nand Flash必看知识</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li><li class="dropdown-item"><!----> <a href="/pages/c7c01f/" class="nav-link">完美世界秋招 C++ 游戏开发面经(Cpp部分)</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" aria-current="page" class="nav-link router-link-exact-active router-link-active">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="嵌入式软件开发" class="dropdown-title"><!----> <span class="title" style="display:;">嵌入式软件开发</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d142c2/" class="nav-link">电子嵌入式通信协议</a></li><li class="dropdown-item"><!----> <a href="/pages/4c6bf3/" class="nav-link">深入浅出SSD</a></li><li class="dropdown-item"><!----> <a href="/pages/d3f36a/" class="nav-link">文件系统</a></li><li class="dropdown-item"><!----> <a href="/pages/e0cca7/" class="nav-link">汇编语言</a></li><li class="dropdown-item"><!----> <a href="/pages/fab2d7/" class="nav-link">STM32</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/db6fb8/" class="nav-link">Git备忘清单</a></li><li class="dropdown-item"><!----> <a href="/pages/e1081f/" class="nav-link">Git 创建删除远程分支</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/1ab9a6/" class="nav-link">Shell 脚本学习笔记</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/907786/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/a2d21e/" class="nav-link">kylinV10-SP1 安装 QT</a></li><li class="dropdown-item"><!----> <a href="/pages/b561cf/" class="nav-link">高并发内存池</a></li><li class="dropdown-item"><!----> <a href="/pages/6ab6d1/" class="nav-link">USBGUARD 项目编译环境配置</a></li><li class="dropdown-item"><!----> <a href="/pages/883f02/" class="nav-link">Power_Destory 项目</a></li><li class="dropdown-item"><!----> <a href="/pages/479472/" class="nav-link">U 盘清除工具编译教程</a></li><li class="dropdown-item"><!----> <a href="/pages/9c4241/" class="nav-link">个人博客代码推送教程</a></li><li class="dropdown-item"><!----> <a href="/pages/3ad765/" class="nav-link">SVN Trunk Branches的Merge操作</a></li><li class="dropdown-item"><!----> <a href="/pages/0c0ca8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="MFC" class="dropdown-title"><!----> <span class="title" style="display:;">MFC</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/a4b108/" class="nav-link">MFC编程随记</a></li><li class="dropdown-item"><!----> <a href="/pages/41acbd/" class="nav-link">MFC实现ini配置文件的读取</a></li><li class="dropdown-item"><!----> <a href="/pages/951a7a/" class="nav-link">MFC实现点击列表头排序</a></li><li class="dropdown-item"><!----> <a href="/pages/a8598f/" class="nav-link">贴图法美化Button按钮</a></li><li class="dropdown-item"><!----> <a href="/pages/054516/" class="nav-link">MFC使用细节</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="闪存" class="dropdown-title"><!----> <span class="title" style="display:;">闪存</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/b925b8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li><li class="dropdown-item"><!----> <a href="/pages/28ec23/" class="nav-link">NAND Flash</a></li><li class="dropdown-item"><!----> <a href="/pages/62bf40/" class="nav-link">ARM 处理器</a></li><li class="dropdown-item"><!----> <a href="/pages/1a9374/" class="nav-link">嵌入式基础知识-存储器</a></li><li class="dropdown-item"><!----> <a href="/pages/aac5e3/" class="nav-link">闪存存储和制造技术概述</a></li><li class="dropdown-item"><!----> <a href="/pages/8f6056/" class="nav-link">芯片IO驱动力</a></li><li class="dropdown-item"><!----> <a href="/pages/d146b8/" class="nav-link">主流先进封装技术介绍</a></li><li class="dropdown-item"><!----> <a href="/pages/16f0ba/" class="nav-link">NAND Flash基础</a></li><li class="dropdown-item"><!----> <a href="/pages/90d8d0/" class="nav-link">基于PA算法的FTL引导</a></li><li class="dropdown-item"><!----> <a href="/pages/eb672b/" class="nav-link">SD逻辑擦除和物理擦除</a></li><li class="dropdown-item"><!----> <a href="/pages/747121/" class="nav-link">NAND Flash的SDR、ONFI、DDR接口</a></li><li class="dropdown-item"><!----> <a href="/pages/1eb351/" class="nav-link">【详解】Nand Flash必看知识</a></li><li class="dropdown-item"><!----> <a href="/pages/d2512a/" class="nav-link">【两万字详解】Nand Flash必看知识</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li><li class="dropdown-item"><!----> <a href="/pages/c7c01f/" class="nav-link">完美世界秋招 C++ 游戏开发面经(Cpp部分)</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>网络</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>操作系统</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>数据结构</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/pages/3b34ba/" aria-current="page" class="active sidebar-link">数据结构基础小结</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/pages/3b34ba/#概述" class="sidebar-link">概述</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是算法" class="sidebar-link">什么是算法？</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是数据结构" class="sidebar-link">什么是数据结构？</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#数据结构都有哪些组成方式" class="sidebar-link">数据结构都有哪些组成方式？</a></li><li class="sidebar-sub-header level4"><a href="/pages/3b34ba/#基本数据结构" class="sidebar-link">基本数据结构</a></li><li class="sidebar-sub-header level4"><a href="/pages/3b34ba/#其他数据结构" class="sidebar-link">其他数据结构</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#时间复杂度" class="sidebar-link">时间复杂度</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#空间复杂度" class="sidebar-link">空间复杂度</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/3b34ba/#线性结构" class="sidebar-link">线性结构</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是数组" class="sidebar-link">什么是数组</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是链表" class="sidebar-link">什么是链表</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是栈" class="sidebar-link">什么是栈</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是队列" class="sidebar-link">什么是队列</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是散列表" class="sidebar-link">什么是散列表</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/3b34ba/#树" class="sidebar-link">树</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是树" class="sidebar-link">什么是树</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是二叉树" class="sidebar-link">什么是二叉树</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是二叉堆" class="sidebar-link">什么是二叉堆</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是优先队列" class="sidebar-link">什么是优先队列</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/3b34ba/#图" class="sidebar-link">图</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#什么是图" class="sidebar-link">什么是图</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#图的分类" class="sidebar-link">图的分类</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#图的表示方式" class="sidebar-link">图的表示方式</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#常见图算法" class="sidebar-link">常见图算法</a></li><li class="sidebar-sub-header level3"><a href="/pages/3b34ba/#实际应用" class="sidebar-link">实际应用</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/3b34ba/#红黑树" class="sidebar-link">红黑树</a></li><li class="sidebar-sub-header level2"><a href="/pages/3b34ba/#布隆过滤器" class="sidebar-link">布隆过滤器</a></li></ul></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>算法</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Linux</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><span data-v-06225672>计算机基础</span></li><li data-v-06225672><span data-v-06225672>数据结构</span></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="javascript:;" data-v-06225672>霜晨月</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2023-07-23</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">数据结构基础小结<!----></h1> <!----> <div class="theme-vdoing-content content__default"><h1 id="数据结构基础小结"><a href="#数据结构基础小结" class="header-anchor">#</a> 数据结构基础小结</h1> <h2 id="概述"><a href="#概述" class="header-anchor">#</a> 概述</h2> <h3 id="什么是算法"><a href="#什么是算法" class="header-anchor">#</a> 什么是算法？</h3> <p>在计算机领域里，算法是一系列程序指令，用于处理特定的运算和逻辑问题。</p> <p>衡量算法优劣的主要标准是时间复杂度和空间复杂度。</p> <h3 id="什么是数据结构"><a href="#什么是数据结构" class="header-anchor">#</a> 什么是数据结构？</h3> <p>数据结构，对应的英文单词是 data structure，是数据的组织、管理和存储格式，其使用目的是为了高效地访问和修改数据。</p> <h3 id="数据结构都有哪些组成方式"><a href="#数据结构都有哪些组成方式" class="header-anchor">#</a> 数据结构都有哪些组成方式？</h3> <h4 id="基本数据结构"><a href="#基本数据结构" class="header-anchor">#</a> 基本数据结构</h4> <ol><li><p>线性结构</p> <p>线性结构是最简单的数据结构，包括<strong>数组、链表</strong>，以及由它们衍生出来的<strong>栈、 队列、哈希表</strong>。</p></li> <li><p>树</p> <p>树是相对复杂的数据结构，其中比较有代表性的是二叉树，由它又衍生出了二叉堆之类的数据结构。</p></li> <li><p>图</p> <p>图是更为复杂的数据结构，因为在图中会呈现出多对多的关联关系。</p></li></ol> <h4 id="其他数据结构"><a href="#其他数据结构" class="header-anchor">#</a> 其他数据结构</h4> <p>除上述所列的几种基本数据结构以外，还有一些其他的千奇百怪的数据结构。它们由基本数据结构变形而来，用于解决某些特定问题，如<strong>跳表、哈希链表、位图</strong>等</p> <h3 id="时间复杂度"><a href="#时间复杂度" class="header-anchor">#</a> 时间复杂度</h3> <p>时间复杂度是对一个<strong>算法运行时间长短</strong>的量度。它描述了算法运行时间与输入大小之间的关系，记作 T(n)=O(f(n))。</p> <p>时间复杂度通常用大 O 记号（O表示）来表示，表示<strong>算法执行时间的上界</strong>。</p> <p>因为渐进时间复杂度用大写 O 来表示，所以也被称为<strong>大 O 表示法</strong>。</p> <p>O(1) &lt; O(logn) &lt; O(n) &lt; O（n²)</p> <h3 id="空间复杂度"><a href="#空间复杂度" class="header-anchor">#</a> 空间复杂度</h3> <p>空间复杂度是对一个<strong>算法在运行过程中临时占用存储空间大小</strong>的量度，它同样使用了大 O 表示法，记作 S(n)=O(f(n))。</p> <h2 id="线性结构"><a href="#线性结构" class="header-anchor">#</a> 线性结构</h2> <h3 id="什么是数组"><a href="#什么是数组" class="header-anchor">#</a> 什么是数组</h3> <p>数组是由<strong>有限个相同类型的变量所组成的有序集合</strong>，它的物理存储方式是<strong>顺序存储</strong>，访问方式是<strong>随机访问</strong>。</p> <ul><li>利用下标查找数组元素的时间复杂度是 O(1)，</li> <li>中间插入、删除数组元素的时间复杂度是 O(n)。</li></ul> <h3 id="什么是链表"><a href="#什么是链表" class="header-anchor">#</a> 什么是链表</h3> <p>链表是一种链式数据结构，<strong>由若干节点组成，每个节点包含指向下一节点的指针</strong>。链表的物理存储方式是<strong>随机存储</strong>，访问方式是<strong>顺序访问</strong>。（和数组相反）</p> <ul><li>查找链表节点的时间复杂度是 O(n)，</li> <li>中间插入、删除节点的时间复杂度是 O(1)。</li></ul> <h3 id="什么是栈"><a href="#什么是栈" class="header-anchor">#</a> 什么是栈</h3> <p>栈是一种线性逻辑结构，可以用数组实现，也可以用链表实现。栈包含入栈和出栈操作，遵循<strong>先入后出</strong>的原则（FILO）。</p> <h3 id="什么是队列"><a href="#什么是队列" class="header-anchor">#</a> 什么是队列</h3> <p>队列也是一种线性逻辑结构，可以用数组实现，也可以用链表实现。队列包含入队和出队操作，遵循<strong>先入先出</strong>的原则（FIFO）。</p> <h3 id="什么是散列表"><a href="#什么是散列表" class="header-anchor">#</a> 什么是散列表</h3> <p>散列表也叫<strong>哈希表</strong>，是<strong>存储 Key-Value 映射的集合</strong>。对于某一个 Key，散列表可以在接近 O(1) 的时间内进行读写操作。</p> <p>散列表通过哈希函数实现 Key 和数组下标的转换，通过【开放寻址法】和【链表法】来解决哈希冲突。</p> <ol><li><p><strong>开放寻址法</strong>：当发生冲突时，它会尝试在哈希表中的其他位置继续寻找可用的位置来存储数据，直到找到一个空闲的位置为止。</p> <p>具体来说，开放寻址法通过以下方式处理哈希冲突：</p> <ul><li>线性探测法：发生冲突时，依次检查下一个位置，直到找到一个空闲位置。</li> <li>二次探测法：发生冲突时，按照某个固定的二次探测序列依次检查下一个位置，直到找到一个空闲位置。</li> <li>双重哈希法：使用两个不同的哈希函数来计算下一个探测位置。</li></ul> <blockquote><p>开放寻址法的<strong>优点</strong>是不需要额外的数据结构来存储冲突的数据，节省了内存空间。但它的<strong>缺点</strong>是容易产生聚集性冲突，导致哈希表的性能下降。</p></blockquote></li> <li><p><strong>链表法</strong>：它在哈希表的每个桶中维护一个链表（或其他数据结构，如红黑树），当发生冲突时，将冲突的数据存储在该桶的链表中。</p> <p>具体来说，链表法通过以下方式处理哈希冲突：</p> <ul><li>将哈希表的每个桶初始化为一个空链表。</li> <li>当发生哈希冲突时，将新的数据插入到对应桶的链表中。</li></ul> <blockquote><p>链表法的<strong>优点</strong>是容易实现，且能够有效地处理较多的哈希冲突。<strong>然而</strong>，当链表过长时，会影响哈希表的性能，因为查找操作需要在链表上进行线性搜索。</p></blockquote></li></ol> <h2 id="树"><a href="#树" class="header-anchor">#</a> 树</h2> <h3 id="什么是树"><a href="#什么是树" class="header-anchor">#</a> 什么是树</h3> <p>树是 n 个节点的<strong>有限集</strong>，有且仅有一个特定的称为根的节点。</p> <p>当 n&gt;1 时，其余节点可分为 m 个互不相交的有限集，每一个集合本身又是一个树，并称为根的子树。</p> <h3 id="什么是二叉树"><a href="#什么是二叉树" class="header-anchor">#</a> 什么是二叉树</h3> <p>二叉树是树的一种特殊形式，每一个节点最多有两个孩子节点。</p> <blockquote><p>二叉树包含【完全二叉树】和【满二叉树】两种特殊形式。</p></blockquote> <ol><li><p>完全二叉树（Complete Binary Tree）：除了最后一层可能不满外，其他层的节点都必须是满的，并且最后一层的节点都尽量靠左排列。</p> <p>具体特点如下：</p> <ul><li>所有叶子节点都集中在二叉树的最后两层。</li> <li>最后一层的叶子节点都靠左排列。</li> <li>如果一个节点只有右子树而没有左子树，那么它必定是最后一层的节点。</li></ul> <p><strong>完全二叉树在数组中的存储非常高效，因为它的特殊结构允许用数组的形式表示，无需使用额外的指针。</strong></p></li> <li><p>满二叉树（Full Binary Tree）：除了叶子节点外，每个节点都有两个子节点，即每个节点的度数都是 2。</p> <p>具体特点如下：</p> <ul><li>所有非叶子节点都有两个子节点。</li> <li>所有叶子节点都在同一层上。</li></ul> <p><strong>满二叉树的高度是固定的，由节点数决定，且在给定节点数下，它的高度是最小的。但是满二叉树并不常见，一般完全二叉树更为常见。</strong></p></li></ol> <blockquote><p>二叉树的遍历方式有四种，根据遍历节点之间的关系，可以分为以下 4 种方式：</p></blockquote> <ol><li>前序遍历（Pre-order Traversal）：先访问根节点，然后按照左子树、右子树的顺序递归遍历。（根左右）</li> <li>中序遍历（In-order Traversal）：先按照左子树的顺序递归遍历，然后访问根节点，最后按照右子树的顺序递归遍历。（左根右）</li> <li>后序遍历（Post-order Traversal）：先按照左子树、右子树的顺序递归遍历，然后访问根节点。（左右根）</li> <li>层序遍历（Level-order Traversal）：从上到下逐层遍历二叉树的节点，同一层节点按照从左到右的顺序访问。（上到下）</li></ol> <blockquote><p>另外，从更宏观的角度划分，二叉树的遍历方式可以分为两大类：</p></blockquote> <ol><li>深度优先遍历（Depth-First Traversal）：以深度为优先级的遍历方式，即先访问根节点，然后递归遍历左子树和右子树。（根左右）</li> <li>广度优先遍历（Breadth-First Traversal）：以广度为优先级的遍历方式，即按照层序遍历的顺序逐层遍历二叉树的节点。</li></ol> <p><strong>深度优先遍历</strong>适用于查找、搜索等问题（栈），而<strong>广度优先遍历</strong>适用于层次遍历和最短路径等问题（队列）。</p> <h3 id="什么是二叉堆"><a href="#什么是二叉堆" class="header-anchor">#</a> 什么是二叉堆</h3> <p>二叉堆是一种特殊的完全二叉树，分为最大堆和最小堆。</p> <ul><li>在最大堆中，任何一个父节点的值，都<strong>大于或等于</strong>它左、右孩子节点的值。</li> <li>在最小堆中，任何一个父节点的值，都<strong>小于或等于</strong>它左、右孩子节点的值。</li></ul> <h3 id="什么是优先队列"><a href="#什么是优先队列" class="header-anchor">#</a> 什么是优先队列</h3> <p>优先队列分为最大优先队列和最小优先队列。</p> <ul><li>在最大优先队列中，无论入队顺序如何，当前最大的元素都会<strong>优先出队</strong>，这是基于最大堆实现的。</li> <li>在最小优先队列中，无论入队顺序如何，当前最小的元素都会优先出队，这是基于最小堆实现的</li></ul> <h2 id="图"><a href="#图" class="header-anchor">#</a> 图</h2> <h3 id="什么是图"><a href="#什么是图" class="header-anchor">#</a> 什么是图</h3> <p>图是由一组节点（顶点）和连接这些节点的边组成的集合。</p> <p>节点表示实体，边表示节点之间的关系。</p> <p>图可以是有向图（Directed Graph），即边有方向性，也可以是无向图（Undirected Graph），边没有方向性。</p> <h3 id="图的分类"><a href="#图的分类" class="header-anchor">#</a> 图的分类</h3> <ul><li>简单图：图中没有自环和重复的边。</li> <li>带权图：图的边带有权重，表示节点之间的距离或代价。</li> <li>连通图：任意两个节点之间都有路径连接。</li> <li>有向无环图（DAG）：没有环的有向图，常用于表示任务依赖关系。</li></ul> <h3 id="图的表示方式"><a href="#图的表示方式" class="header-anchor">#</a> 图的表示方式</h3> <ul><li>邻接矩阵：使用二维数组表示节点之间的连接关系。</li> <li>邻接表：使用链表或数组表示节点的邻居节点。</li></ul> <h3 id="常见图算法"><a href="#常见图算法" class="header-anchor">#</a> 常见图算法</h3> <ul><li>广度优先搜索（BFS）：用于在图中查找最短路径或层次遍历。</li> <li>深度优先搜索（DFS）：用于查找图中的所有路径或判断是否存在环。</li> <li>Dijkstra 算法：用于找到带权图中的最短路径。</li> <li>Kruskal 算法：用于求最小生成树，适用于带权无向图。</li> <li>拓扑排序：用于有向无环图中的任务调度。</li></ul> <h3 id="实际应用"><a href="#实际应用" class="header-anchor">#</a> 实际应用</h3> <ul><li>网络通信：图可用于表示计算机网络中的节点和连接。</li> <li>社交网络：图可用于表示用户之间的关系，进行社交网络分析。</li> <li>路径规划：图可用于地图导航、GPS 定位等。</li> <li>数据库查询优化：用图的拓扑排序来优化数据库查询计划。</li> <li>任务调度：用有向无环图表示任务依赖，实现任务调度和并行处理。</li></ul> <blockquote><ol><li>BFS - 广度优先搜索（Breadth-First Search）</li> <li>DFS - 深度优先搜索（Depth-First Search）</li> <li>DAG - 有向无环图（Directed Acyclic Graph）</li> <li>GPS - 全球定位系统（Global Positioning System）</li></ol></blockquote> <h2 id="红黑树"><a href="#红黑树" class="header-anchor">#</a> 红黑树</h2> <p>红黑树是一种<strong>自平衡二叉搜索树</strong>（通过颜色调整和旋转操作），它在插入和删除节点时能够自动调整结构，保持树的平衡性，从而保证查找、插入和删除操作的时间复杂度稳定在 O(log n)。</p> <p><strong>红黑树特点</strong>：</p> <ul><li>每个节点都是红色或黑色。</li> <li>根节点是黑色。</li> <li>叶子节点（空节点）都是黑色。</li> <li>红色节点的子节点都是黑色。</li> <li>从任意节点到其每个叶子节点的路径上包含相同数量的黑色节点（即相同的黑色高度）。</li></ul> <p><strong>红黑树的应用</strong>：</p> <p>TreeMap、TreeSet 以及 JDK1.8 的 HashMap 底层都用到了红黑树。</p> <p><strong>为什么要用红黑树？</strong></p> <p>简单来说红黑树就是为了解决二叉查找树的缺陷，因为二叉查找树在某些情况下会退化成一个线性结构。</p> <h2 id="布隆过滤器"><a href="#布隆过滤器" class="header-anchor">#</a> 布隆过滤器</h2> <p>布隆过滤器（Bloom Filter）是一种空间高效的概率型数据结构，<strong>用于快速判断一个元素是否存在于一个集合中</strong>。</p> <p>实际上是一个位数组（通常用二进制位表示），以及一系列哈希函数。</p> <p>它的主要特点是快速查询、低存储消耗，但可能会产生一定的误判率。</p> <p><strong>布隆过滤器通常用于以下场景</strong>：</p> <ol><li>缓存加速：在缓存中判断一个数据是否存在，如果不存在，则不需要从数据库或其他存储中加载数据，从而加速数据的查询。</li> <li>数据库查询优化：可以在数据库查询之前，先通过布隆过滤器快速判断数据是否可能存在，从而减少对数据库的查询负担。</li> <li>分布式系统：在分布式系统中，可以使用布隆过滤器来快速判断数据是否存在于分布式缓存或分布式数据库中。</li> <li>防止缓存穿透：当请求的数据在缓存中不存在时，可以使用布隆过滤器先进行判断，如果判断结果为不存在，则可以直接返回，避免对数据库等存储系统的过多查询。</li></ol> <p>由于误判率的存在，布隆过滤器不适合用于需要绝对精确判断的场景</p> <p><strong>具体实现步骤如下：</strong></p> <ol><li>初始化位数组：创建一个位数组，并将所有位初始化为 0。位数组的大小通常根据预期元素数量和期望的误判率来确定。</li> <li>添加元素：将待添加的元素通过多个哈希函数计算出一系列哈希值，然后将对应位置的位设置为 1。通常会选择多个不同的哈希函数，以增加散列效果。</li> <li>查询元素：将待查询的元素通过相同的哈希函数计算出一系列哈希值，然后检查对应位置的位。如果所有位置的位都为 1，则表示元素可能存在；如果有任何一位为 0，则表示元素一定不存在。</li></ol></div></div> <!----> <div class="page-edit"><!----> <!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2024/6/3 14:54:44</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/pages/6048a8/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">硬件结构</div></a> <a href="/pages/2dcfa1/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">两数之和</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/pages/6048a8/" class="prev">硬件结构</a></span> <span class="next"><a href="/pages/2dcfa1/">两数之和</a>→
      </span></p></div></div></div> <!----></main></div> <div class="footer"><!----> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2025
    <span>霜晨月</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><canvas id="vuepress-canvas-cursor"></canvas></div></div>
    <script src="/assets/js/app.67adcfd9.js" defer></script><script src="/assets/js/4.9aaa1650.js" defer></script><script src="/assets/js/1.5474518c.js" defer></script><script src="/assets/js/3.593d14fc.js" defer></script><script src="/assets/js/79.3d75e618.js" defer></script>
  </body>
</html>
